package onewayStreet;

public class FabricCarsFromSense1 extends FabricCars {
		
	public FabricCarsFromSense1(onewayStreet o  ) {	super(o);} // constructor
	
	protected synchronized void nieuwAutoFromSense1(Car[] c, int i, onewayStreet o) {
		int carId = getAndIncrementCarId();
		c[i]=new CarFromSense1(carId,o  );	
		System.out.print  ("	Fabriek: Auto " + c[i].getCarId() + " uit Sense1 .	");		
	}
	
	
	public void run() {		
		
		Car [] c =new Car[ nMaxCars]; 	// for thread pool
		System.out.println ("Fabriek Auto's (uit Sense1) begint.");
		
		for( int i=0; i< nMaxCars ; i++) { 	//while (true){
			nieuwAutoFromSense1(c, i, getO());		c[i].start();
			try {Thread.sleep((int)(Math.random()*SLEEPfromSENSE1));} catch(InterruptedException e) {};			
		}
	}

	
	
}
